package by.parfen.game.datamodel;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class SessionsData implements Serializable {
	private static final long serialVersionUID = 1L;

	private List<SessionObject> sessionDataList;

	public SessionsData() {
		sessionDataList = new ArrayList<SessionObject>();
	}

	public List<SessionObject> sessionDataList() {
		return sessionDataList;
	}

	public void addSessionId(String sessionId) {
		SessionObject s = new SessionObject(sessionId);
		if (sessionDataList.indexOf(s) < 0) {
			// System.out.println("Added a new session " + sessionId);
			sessionDataList.add(s);
		} else {
			// System.out.println("Session " + sessionId + " already exists!");
		}
	}

	public void delSessionId(String sessionId) {
		SessionObject s = new SessionObject(sessionId);
		int i = sessionDataList.indexOf(s);
		if (i >= 0) {
			sessionDataList.remove(i);
		}
	}

}
